<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<%@ include file="/common/ssb/include/common-base.jsp"%>
	<title>渠道商管理</title>
	<!-- Tell the browser to be responsive to screen width -->
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>

<!-- Part 一、 以下是body主体内容的模块区域 -->
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

	<!-- top start -->
	<%@include file="/common/ssb/top.jsp" %>
	<!-- top end -->
	<!-- left start -->
	<%@include file="/common/ssb/left.jsp" %>
	<!-- left end-->

	<div class="content-wrapper">
		<!-- Main start -->
		<section class="content">
			<div id="div_hidden_content" class="hidden" style="display:none;">
				<input name="templateType" type="hidden" value="all"/>
				<div id="hidden_common_final">
					<!-- temp="hidden_common_final" start -->
					<input name="mainObjName" type="hidden" value="uctUser">
					<input name="mainObjPrimaryKey" type="hidden" value="userId">
					<input name="objNameAll" type="hidden" value="uctUser">
					<!-- temp="hidden_common_final" end -->
				</div>
				<!-- temp="delForm_hidden" start -->
				<div id="delForm_hidden" style="display:none;">
					<input type="hidden" name="pageName" value="user-list"/>
					<input type="hidden" name="formName" value="delForm"/>
				</div>
				<!-- temp="delForm_hidden" end -->
			</div>
			<div class="row">
				<div class="col-xs-12">
					<textarea rows="1" id="copy_textarea" style="display: none" cols="100"></textarea>
					<!------搜索  start ------->
					<div class="box box-info">
						<!--搜索title  start -->
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-search"></i> 渠道商管理搜索</h3>
							<div class="box-tools pull-right">
								<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
							</div>
						</div>
						<!--搜索title  end -->
						<div class="box-body">
							<div style="display:none;">
								<div class="form-group">
									<select id="searchForm_ssInsurPro_proType" class="form-control "
											data-dict-code="dictItemList" data-dict-cate="proCategory" data-type-tag="select">
										<option value="">--请选择--</option>
									</select>
								</div>
							</div>
							<form id="searchForm" action="javascript:;">
								<!-- temp="searchForm_hidden" start -->
								<div id="searchForm_hidden" style="display:none;">
									<input type="hidden" name="pageName" value="user-list"/>
									<input type="hidden" name="formName" value="searchForm-new"/>
									<input type="hidden" name="uctUser.w_userType" value="broker"/>
									<input type="hidden" name="uctUser.w_sysEname" value="ssb"/>
									<c:if test="${loginUser.userType=='broker'}">
										<input type="hidden" name="uctUser.wo_orgId" value="${loginUser.userId}"/>
										<input type="hidden" name="uctUser.wo_userId" value="${loginUser.userId}"/>
									</c:if>

									<input type="hidden" name="orderBy" value="uctUser.create_time desc"/>
								</div>
								<!-- temp="searchForm_hidden" end -->

								<!-- temp="searchForm_content" start -->
								<div id="searchForm_content" class="form-group"  data-temp-code="true" data-temp-type="searchForm" data-temp-form-id="searchForm">


									<table class="table table-bordered bordercolor">
										<tbody>
										<tr>
											<td class="active" align="right"><label class="form-control-static">渠道商名称：</label></td>
											<td>
												<div class="form-group"><input name="uctUser.wl_userCname" class="form-control clean"
																			   maxlength="30" data-temp-obj="uctUser.userCname"></div>
											</td>
											<td class="active" align="right"><label class="form-control-static">状态：</label></td>
											<td>
												<div class="form-group"><select id="searchForm_uctUser_userStatus"
																				name="uctUser.wl_userStatus" class="form-control  clean"
																				data-temp-obj="uctUser.userStatus"
																				data-dict-code="dictItemList"
																				data-dict-cate="userStatus" data-type-tag="select"
																				data-def="">
													<option value="">--请选择--</option>
												</select></div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label class="form-control-static">渠道商账号：</label></td>
											<td>
												<div class="form-group"><input name="uctUser.wl_userEname" class="form-control clean"
																			   maxlength="30" data-temp-obj="uctUser.userEname"></div>
											</td>
											<td class="active" align="right"><label class="form-control-static">级别：</label></td>
											<td>
												<div class="form-group"><select id="searchForm_uctUser_userLevel"
																				name="uctUser.wl_userLevel" class="form-control  clean"
																				data-temp-obj="uctUser.userLevel"
																				data-dict-code="dictItemList"
																				data-dict-cate="channelLevel" data-type-tag="select"
																				data-def="">
													<option value="">--请选择--</option>
												</select></div>
											</td>
										</tr>
										<tr>
											<td class="active" align="right"><label class="form-control-static">前端系统名称：</label></td>
											<td>
												<div class="form-group"><input name="uctUser.wl_frontSysName" class="form-control clean"
																			   maxlength="30" data-temp-obj="uctUser.frontSysName"></div>
											</td>
										</tr>
										</tbody>
									</table>
								</div>
								<!-- temp="searchForm_content" end -->
							</form>
							<div class="box-footer text-center">
								<button type="button" class="btn btn-success" onclick="getTableData();" data-temp-event="searchForm_hidden"><i class="fa fa-search"></i> 查询</button> 
								<button type="button" class="btn btn-warning" onclick="mytools.cleanData('#searchForm');">重置 </button>
							</div>
						</div>
					</div>
					<!------- 搜索 end -------->

					<!------- 列表 start -------->
					<div class="box box-success">
						<!--列表title  start -->
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-table"></i> 查询<c:if test="${loginUser.userType=='broker'}">下级渠道商结果</c:if><c:if test="${loginUser.userType=='manager'}">所有渠道商结果</c:if>
								<c:if test="${loginUser.sysFlag=='2'||loginUser.sysFlag=='3'}">
									　　　<button id="button_to_add" onclick="toAdd('0');" class="btn btn-success" type="button"><i class="fa fa-plus-circle"></i> 增加一级 </button>
								</c:if>
								<c:if test="${loginUser.user.specField=='T'}">
									&nbsp;<button id="button_to_add_child" onclick="toAdd('1');" class="btn btn-info" type="button"><i class="fa fa-plus-circle"></i> 增加子级</button>
								</c:if>
								&nbsp;<button onclick="toSetPro();" class="btn btn-primary" type="button"><i class="fa fa-cog"></i> 配置产品</button>
								<button onclick="toSelectChanel();" class="btn btn-default" type="button"><i class="fa fa-cog"></i> 平移渠道商</button>
							</h3>
							<div class="box-tools pull-right">
								<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
							</div>
						</div>
						<div class="box-body">
							<table id="dataList" class="table table-bordered table-hover">
								<thead>
								<tr id="dataList_thead_content" data-temp-code="true" data-temp-type="table" data-temp-show="dataList_template_content">
									<th>序号</th>
									<!-- temp="dataList_thead_content" start -->

									<th data-temp-obj="uctUser.userCname">渠道商名称</th>
									<th data-temp-obj="uctUser.userLevel">级别</th>
									<th data-temp-obj="uctUser.userEname">渠道商账号</th>
									<th data-temp-obj="uctUser.userEname">前端系统名称</th>
									<th>投保链接</th>
									<th>操作</th>
									<!-- temp="dataList_thead_content" end -->
								</tr>
								</thead>
								<tbody id="dataList-body">

								</tbody>
							</table>
						</div>

						<div class="box-footer text-center">
							<ul id="dataList-page" class="pagination">
							</ul>
						</div>
					</div>
					<!------- 列表 end -------->
				</div>
			</div>

			<div win-title="添加窗口" class="modal fade" id="my_modal_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:80%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">信息添加[<span id="span_add_title"></span>]</font> 
							</h4>
						</div>

						<div class="modal-body">

							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs" id="myTab-add">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabAdd_1">
										<form class="form-horizontal addFormBody" role="form" id="addForm1" action="javascript:void(0)">
											<input type="hidden" class="formToken" id="addForm1_formToken" name="formToken" />
											<!-- temp="addForm1_hidden" start -->
											<div id="addForm1_hidden" style="display:none;">
												<input type="hidden" name="pageName" value="user-list"/>
												<input type="hidden" name="formName" value="addForm"/>
												<input type="hidden" name="uctUser.userType" value="broker"/>
												<input type="hidden" name="uctUser.sysEname" value="ssb"/>
												<input type="hidden" name="uctUser.delStatus" value="0"/>
												<input type="hidden" name="uctUser.userScore" value="10"/>
												<input type="hidden" name="uctUser.regSource" value="plate"/>
												<input type="hidden" name="uctUser.orgId" class="father_channel_id" />
												<input type="hidden" name="uctUser.orgEname" class="father_channel_name"/>
												<input type="hidden" name="uctUser.userLevel" class="uctUser_userLevel" value=""/>
												<input type="hidden" name="uctUser.userPass"  value="" />
												<input type="hidden" name="uctUser.usbKey"  value="0" />
											</div>
											<!-- temp="addForm1_hidden" end -->

											<!-- temp="addForm1_content" start -->
											<div id="addForm1_content" data-temp-code="true" data-temp-type="addForm" data-temp-form-id="addForm1">


												<table class="table table-bordered bordercolor" data-sort="sortDisabled">
													<tbody>
													<!-- <tr>
													  <td class="active" align="right"><label class="form-control-static">所属级别：</label></td>
                                                      <td>
                                                          <div class="form-group"><select disabled="disabled"
                                                                  id="addForm1_uctUser_userLevel"
                                                                   class="form-control uctUser_userLevel clean"
                                                                  data-temp-obj="uctUser.userLevel"
                                                                  data-dict-code="dictItemList"
                                                                  data-dict-cate="channelLevel" data-type-tag="select"
                                                                  placeholder="必填项" data-bv-notempty="true"
                                                                  data-bv-notempty-message="不能为空" data-def="">
                                                              <option value="" remark="" selected="selected"> --请选择--
                                                              </option>
                                                          </select></div>
                                                      </td>
                                                      <td class="active" align="right"><label class="form-control-static">上级渠道商：</label></td>
                                                      <td>
                                                          <div class="form-control-static">
                                                              <span class="father_channel_name">${loginUser.userCname}</span>
                                                          </div>
                                                          <div class="form-group"><select disabled id="addForm1_father" name="uctUser.fatherId"
                                                                                          class="form-control  clean" data-dict-code="dymicSql" data-dict-cate=""
                                                                                          data-colmun="{value:'userId',text:'userCname'}" data-obj-name="uctUser"
																						  data-page-name="user-list"
                                                                                          data-form-name="searchForm-new"
                                                                                          data-condition="uctUser.w_sysEname=ssb&uctUser.w_userType=broker"
                                                                                          data-type-tag="select" placeholder="必填项" data-bv-notempty="true"
                                                                                          data-bv-notempty-message="不能为空"
                                                                                          data-def="" onchange="mytools.setSelectValueText(this,'#addForm1_orgId','#addForm1_orgEname')" >
                                                              <option value="">--请选择--</option>
                                                          </select></div>
                                                      </td>
                                                  </tr>-->
													<tr>
														<td class="active" align="right"><label class="form-control-static">渠道商名称：</label></td>
														<td><div class="form-group"><input name="uctUser.userCname" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userCname" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
														<td class="active" align="right"><label class="form-control-static">联系电话：</label></td>
														<td><div class="form-group"><input name="uctUser.mobile" class="form-control clean" maxlength="30" data-temp-obj="uctUser.mobile" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">开户人姓名：</label></td>
														<td><div class="form-group"><input name="uctUser.userTitle" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userTitle" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
														<td class="active" align="right"><label class="form-control-static">银行卡号：</label></td>
														<td><div class="form-group"><input name="uctUser.cardNum" class="form-control clean" maxlength="30" data-temp-obj="uctUser.cardNum" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">开户银行：</label></td>
														<td><div class="form-group"><input name="uctUser.cardType" class="form-control clean" maxlength="30" data-temp-obj="uctUser.cardType" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
														<td class="active" align="right"><label class="form-control-static">是否可发展下级：</label></td>
														<td><div class="form-group"><div class="form-control-static" id="addForm1_uctUser_specField" name="uctUser.specField" data-temp-obj="uctUser.specField" data-dict-code="dictItemList" data-dict-cate="yesOrNo" data-colmun="" data-condition="" data-type-tag="radio" data-def="">[radio]</div> </div></td>
														<%--                                                      <td class="active" align="right"><label class="form-control-static">推广费（%）：</label></td>--%>
														<%--                                                      <td><div class="form-group"><input name="uctUser.usbKey" class="form-control clean" maxlength="10" data-temp-obj="uctUser.usbKey" placeholder="必填项，必须是数字"></div></td>--%>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">登录账号：</label></td>
														<td><div class="form-group"><input name="uctUser.userEname" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userEname" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"
																						   onblur="mytools.validFieldRepeat(this)" data-validate-repeat-message="此登录账号已存在，请更换！"></div></td>
														<td class="active" align="right"><label class="form-control-static">账户状态：</label></td>
														<td><div class="form-group"><div class="form-control-static" id="addForm1_uctUser_userStatus" name="uctUser.userStatus" data-temp-obj="uctUser.userStatus" data-dict-code="dictItemList" data-dict-cate="userStatus" data-colmun="" data-condition="" data-type-tag="radio" data-def="1">[radio]</div> </div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">登录密码：</label></td>
														<td><div class="form-group"><input type="password" name="userPass1" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userPass" data-type-tag="password" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
														<td class="active" align="right"><label class="form-control-static">确认密码：</label></td>
														<td><div class="form-group"><input type="password" name="userPass2" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userPass" data-type-tag="password" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空"></div></td>
													</tr>
													</tbody>
												</table>



											</div>
											<!-- temp="addForm1_content" end -->


											<div class="form-group">
												<div class="col-sm-12">
													<div class="box-footer text-center">
														<button class="btn btn-success pull-left" type="button" onclick="mytools.closeModal('my_modal_add');"> 取消 </button>
														<button class="btn btn-danger pull-right" type="button" onclick="submitForm1('addForm1','');" data-temp-event="addForm1_hidden"> 提 交 </button>
													</div>
												</div>
											</div>

										</form>
									</div>

								</div>
								<!-- tab content e -->
							</div>

						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>

			<div win-title="修改窗口" class="modal fade" id="my_modal_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:80%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">信息修改</font> 
							</h4>
						</div>
						<div class="modal-body">
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs" id="myTab-edit">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabEdit_1">
										<form class="form-horizontal editFormBody" role="form" id="editForm1" action="javascript:void(0)">
											<input type="hidden" class="formToken" id="editForm1_formToken" name="formToken" />
											<!-- temp="editForm1_hidden" start -->
											<div id="editForm1_hidden" style="display:none;">
												<input type="hidden" name="pageName" value="user-list"/>
												<input type="hidden" name="formName" value="editForm"/>
												<input type="hidden" name="uctUser.w_userId" data-name="uctUser.userId" class="uctUser_userId clean">
											</div>
											<!-- temp="editForm1_hidden" end -->

											<!-- temp="editForm1_content" start -->
											<div id="editForm1_content">


												<table class="table table-bordered bordercolor" data-sort="sortDisabled">
													<tbody>
													<!--  <tr>
                                                          <td class="active" align="right"><label class="form-control-static">所属级别：</label></td>
                                                          <td><div class="form-group"><select id="editForm1_uctUser_userLevel" name="uctUser.userLevel" class="form-control  clean" data-temp-obj="uctUser.userLevel" data-dict-code="dictItemList" data-dict-cate="channelLevel" data-type-tag="select" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-def="" data-name="uctUser.userLevel"><option value="" remark="" selected="selected"> --请选择--</option></select></div></td>
                                                          <td class="active" align="right"><label class="form-control-static">上级渠道商：</label></td>
                                                          <td><div class="form-group"><select id="editForm1_uctUser_orgId" name="uctUser.orgId" class="form-control  clean" data-temp-obj="uctUser.orgId" data-dict-code="dymicSql" data-dict-cate="" data-colmun="{value:'userId',text:'userCname'}" data-obj-name="uctUser" data-page-name="user-list" data-form-name="searchForm-new" data-condition="" data-type-tag="select" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-def="" data-name="uctUser.orgId"><option value="">--请选择--</option></select></div></td>
                                                      </tr>-->
													<tr>
														<td class="active" align="right"><label class="form-control-static">渠道商名称：</label></td>
														<td><div class="form-group"><input name="uctUser.userCname" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userCname" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-name="uctUser.userCname"></div></td>
														<td class="active" align="right"><label class="form-control-static">联系电话：</label></td>
														<td><div class="form-group"><input name="uctUser.mobile" class="form-control clean" maxlength="30" data-temp-obj="uctUser.mobile" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-name="uctUser.mobile"></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">开户人姓名：</label></td>
														<td><div class="form-group"><input name="uctUser.userTitle" class="form-control clean" maxlength="30" data-temp-obj="uctUser.userTitle" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-name="uctUser.userTitle"></div></td>
														<td class="active" align="right"><label class="form-control-static">身份证号：</label></td>
														<td><div class="form-group"><input name="uctUser.certNo" class="form-control clean" maxlength="30" data-temp-obj="uctUser.certNo"  data-name="uctUser.certNo"></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">开户银行：</label></td>
														<td><div class="form-group"><input name="uctUser.cardType" class="form-control clean" maxlength="30" data-temp-obj="uctUser.cardType" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-name="uctUser.cardType"></div></td>
														<td class="active" align="right"><label class="form-control-static">银行卡号：</label></td>
														<td><div class="form-group"><input name="uctUser.cardNum" class="form-control clean" maxlength="30" data-temp-obj="uctUser.cardNum" placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" data-name="uctUser.cardNum"></div></td>

														<%--                                                    <td class="active" align="right"><label class="form-control-static">推广费（%）：</label></td>--%>
														<%--                                                    <td><div class="form-group"><input name="uctUser.usbKey" class="form-control clean" maxlength="30" data-temp-obj="uctUser.usbKey" data-name="uctUser.usbKey" placeholder="必填项，必须是数字"></div></td>--%>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">是否可发展下级：</label></td>
														<td><div class="form-group"><div class="form-control-static" id="editForm1_uctUser_specField" name="uctUser.specField" data-temp-obj="uctUser.specField" data-dict-code="dictItemList" data-dict-cate="yesOrNo" data-colmun="" data-condition="" data-type-tag="radio" data-def="" data-name="uctUser.specField">[radio]</div> </div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">登录账号：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.userEname"></span></div></td>
														<td class="active" align="right"><label class="form-control-static">账户状态：</label></td>
														<td><div class="form-group"><div class="form-control-static" id="editForm1_uctUser_userStatus" name="uctUser.userStatus" data-temp-obj="uctUser.userStatus" data-dict-code="dictItemList" data-dict-cate="userStatus" data-colmun="" data-condition="" data-type-tag="radio" data-def="" data-name="uctUser.userStatus">[radio]</div> </div></td>
													</tr>
													</tbody>
												</table>



											</div>
											<!-- temp="editForm1_content" end -->

											<div class="form-group">
												<div class="col-sm-12">
													<div class="box-footer text-center">
														<button class="btn btn-success pull-left" type="button" onclick="mytools.closeModal('my_modal_edit');"> 取消 </button>
														<button class="btn btn-danger pull-right" type="button" onclick="submitForm1('editForm1','');" data-temp-event="editForm1_hidden"> 提 交 </button>
													</div>
												</div>
											</div>
										</form>
									</div>

								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>

			<div win-title="修改密码窗口" class="modal fade" id="my_modal_edit_pass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:80%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">账号密码修改</font>
							</h4>
						</div>
						<div class="modal-body">
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs" id="myTab-edit-pass">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabEdit_1_pass">
										<form class="form-horizontal editpassFormBody" role="form" id="editpassForm1" action="javascript:void(0)">
											<input type="hidden" class="formToken" id="editpassForm1_formToken" name="formToken" />
											<!-- temp="editpassForm1_hidden" start -->
											<div id="editpassForm1_hidden" style="display:none;">
												<input type="hidden" name="pageName" value="user-list"/>
												<input type="hidden" name="formName" value="editForm"/>
												<input type="hidden" name="uctUser.w_userId" data-name="uctUser.userId" class="clean">
												<input type="hidden" name="uctUser.userPass" class="clean"/>
												<input type="hidden" name="user_old_pass" data-name="uctUser.userPass" class="clean"/>
											</div>
											<!-- temp="editpassForm1_hidden" end -->

											<!-- temp="editpassForm1_content" start -->
											<div id="editpassForm1_content">

												<table class="table table-bordered bordercolor">
													<tbody>
													<tr>
														<td class="active" align="right"><label class="form-control-static">登录账号：</label></td>
														<td>
															<div class="form-control-static"><span data-name="uctUser.userEname"></span></div>
														</td>
														<td class="active" align="right"><label class="form-control-static">渠道商名称：</label></td>
														<td>
															<div class="form-control-static"><span data-name="uctUser.userCname"></span></div>
														</td>
													</tr>

													<tr>
														<td class="active" align="right"><label
																class="form-control-static">新的密码：</label></td>
														<td>
															<div class="form-group"><input name="userPass1"
																						   class="form-control clean"
																						   maxlength="30"
																						   placeholder="请输入新的密码"
																						   data-bv-notempty="true"
																						   data-bv-notempty-message="新的密码不能为空"
																						   type="password"></div>
														</td>
														<td class="active" align="right"><label
																class="form-control-static">确认密码：</label></td>
														<td>
															<div class="form-group"><input name="userPass2"
																						   class="form-control clean"
																						   maxlength="30"
																						   placeholder="请输入确认密码"
																						   data-bv-notempty="true"
																						   data-bv-notempty-message="确认密码不能为空"
																						   type="password"></div>
														</td>
													</tr>

													</tbody>
												</table>

											</div>
											<!-- temp="editpassForm1_content" end -->

											<div class="form-group">
												<div class="col-sm-12">
													<div class="box-footer text-center">
														<button class="btn btn-success pull-left" type="button" onclick="mytools.closeModal('my_modal_edit_pass');"> 取消 </button>
														<button class="btn btn-danger pull-right" type="button" onclick="submitForm1('editpassForm1','');" data-temp-event="editpassForm1_hidden"> 提 交 </button>
													</div>
												</div>
											</div>
										</form>
									</div>

								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>

			<div win-title="配置产品" class="modal fade" id="my_modal_set_pro" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:80%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">配置产品-<span id="span_set_pro_title"></span></font>
							</h4>
						</div>
						<div class="modal-body">
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabEdit_1_setpro">
										<form class="form-horizontal editpassFormBody" role="form" id="setproForm1" action="javascript:void(0)">
											<input type="hidden" class="formToken" id="setproForm1_formToken" name="formToken" />
											<!-- temp="setproForm1_hidden" start -->
											<div id="setproForm1_hidden" style="display:none;">
												<input type="hidden" name="pageName" value="ss-org-pro-relation-addbatch2"/>
												<input type="hidden" name="formName" value="addFormBatch"/>
												<input type="hidden" name="ssOrgProRelation.w_userId">
												<input type="hidden" name="ssOrgProRelation.splitAttr" value="proId"/>
												<input type="hidden" name="ifBatch" value="T"/>
											</div>
											<!-- temp="setproForm1_hidden" end -->

											<!-- temp="setproForm1_content" start -->
											<div id="setproForm1_content">
												<div id="proList-body" class="form-group">

												</div>
											</div>
											<!-- temp="setproForm1_content" end -->

											<div class="form-group">
												<div class="col-sm-12">
													<div class="box-footer text-center">
														<button class="btn btn-success pull-left" type="button" onclick="mytools.closeModal('my_modal_set_pro');"> 取消 </button>
														<button class="btn btn-danger pull-right" type="button" onclick="submitForm1('setproForm1','');" > 提 交 </button>
													</div>
												</div>
											</div>
										</form>
									</div>

								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>

			<div win-title="平移渠道商" class="modal fade" id="my_modal_updata_channel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:40%;top:10%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">平移渠道商-<span class="span_updata_channel_title"></span></font>
							</h4>
						</div>
						<div class="modal-body">
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabEdit_1_updataChannel">
										<form class="form-horizontal editpassFormBody" role="form" id="updataChannelForm1" action="javascript:void(0)">
											<input type="hidden" class="formToken" id="updataChannelForm1_formToken" name="formToken" />
											<!-- temp="updataChannelForm1_hidden" start -->
											<div id="updataChannelForm1_hidden" style="display:none;">
												<input type="hidden" name="pageName" value="ss-org-pro-relation-search"/>
												<input type="hidden" name="formName" value="searchForm"/>
												<input type="hidden" name="uctUser.w_orgId" class="clean">
												<input type="hidden" name="uctUser.orgEname" class="clean">
											</div>
											<!-- temp="updataChannelForm1_hidden" end -->

											<!-- temp="updataChannelForm1_content" start -->
											<div id="updataChannelForm1_content">

												<div class="form-group" >
													<div class="f12">
														<i class="fa fa-info-circle text-info"></i> 本操作是将当前选中渠道商“<span class="span_updata_channel_title"></span>”的所有子级全部移入至其他渠道商名下。<br/>
														请先选择需要移入的其他“<span class="red" id="span_in_channel_level_text"></span>”名称！</div>
												</div>
												<div class="form-group" >
													<select id="editForm1_channel_orgUser" name="uctUser.orgId" class="form-control  clean"
															placeholder="必填项" data-bv-notempty="true" data-bv-notempty-message="不能为空" >
														<option value="">-请选择--</option>
													</select>
												</div>
											</div>
											<!-- temp="updataChannelForm1_content" end -->

											<div class="form-group">
												<div class="col-sm-12">
													<div class="box-footer text-center">
														<button class="btn btn-success pull-left" type="button" onclick="mytools.closeModal('my_modal_updata_channel');"> 取消 </button>
														<button class="btn btn-danger pull-right" type="button" onclick="submitForm1('updataChannelForm1','');" > 提 交 </button>
													</div>
												</div>
											</div>
										</form>
									</div>

								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>


			<div win-title="查看窗口" class="modal fade" id="my_modal_view" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog" style="width:80%;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								×
							</button>
							<h4 class="modal-title">
								<font color="red">查看详情</font> 
							</h4>
							<form id="viewForm" action="javascript:void(0)">
								<!-- temp="viewForm_hidden" start -->
								<div id="viewForm_hidden" style="display:none;">
									<input type="hidden" name="pageName" value="user-list"/>
									<input type="hidden" name="formName" value="searchForm-new"/>
									<input type="hidden" name="uctUser.w_userId" value=''/>
								</div>
								<!-- temp="viewForm_hidden" end -->
							</form>
						</div>
						<div class="modal-body viewForm">

							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs" id="myTab-view">
								</ul>

								<!-- tab content start -->
								<div class="tab-content">

									<div class="tab-pane active" id="tabView_1">
										<form class="form-horizontal" role="form" id="viewForm1" action="javascript:void(0)">

											<!-- temp="viewForm1_content" start -->
											<div id="viewForm1_content" class="row viewForm">


												<table class="table table-bordered bordercolor" data-sort="sortDisabled">
													<tbody>
													<tr>
														<td class="active" align="right"><label class="form-control-static">所属级别：</label></td>
														<td class="w280"><div class="form-control-static"><span id="viewForm1_uctUser_userLevel" data-dict-cate="channelLevel" data-dict-code="dictItemList" data-type-tag="select" data-name="uctUser.userLevel" data-dict="channelLevel"></span></div></td>
														<td class="active" align="right"><label class="form-control-static">上级渠道商：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.orgEname"></span></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">渠道商名称：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.userCname"></span></div></td>
														<td class="active" align="right"><label class="form-control-static">联系电话：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.mobile"></span></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">开户人姓名：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.userTitle"></span></div></td>
														<td class="active" align="right"><label class="form-control-static">身份证号：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.certNo"></span></div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">开户银行：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.cardType"></span></div></td>
														<td class="active" align="right"><label class="form-control-static">银行卡号：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.cardNum"></span></div></td>
														<%--                                                      <td class="active" align="right"><label class="form-control-static">推广费：</label></td>--%>
														<%--                                                      <td><div class="form-control-static"><span data-name="uctUser.usbKey"></span>%</div></td>--%>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">是否可发展下级：</label></td>
														<td><div class="form-control-static"><span id="viewForm1_uctUser_specField" data-dict-cate="yesOrNo" data-dict-code="dictItemList" data-type-tag="radio" data-name="uctUser.specField" data-dict="yesOrNo"></span> </div></td>
													</tr>
													<tr>
														<td class="active" align="right"><label class="form-control-static">登录账号：</label></td>
														<td><div class="form-control-static"><span data-name="uctUser.userEname"></span></div></td>
														<td class="active" align="right"><label class="form-control-static">账户状态：</label></td>
														<td><div class="form-control-static"><span id="viewForm1_uctUser_userStatus" data-dict-cate="userStatus" data-dict-code="dictItemList" data-type-tag="radio" data-name="uctUser.userStatus" data-dict="userStatus"></span> </div></td>
													</tr>
													</tbody>
												</table>



											</div>
											<!-- temp="viewForm1_content" end -->

										</form>
										<div class="form-group">
											<div class="col-sm-12">
												<div class="box-footer text-center">
													<button class="btn btn-success pull-right" type="button" onclick="mytools.closeModal('my_modal_view');"> 关闭 </button>
												</div>
											</div>
										</div>
									</div>


								</div>
								<!-- tab content e -->
							</div>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
			</div>

			<!-- Part 二、以下是template模板定义的模块区域 -->
			<script type="text/template" id="dataList-template">
				<? for ( var i = 0; i < rows.length; i++) {?>
				<tr>
					<th style="display:none;"><?=strUtil.doNull(rows[i].uctUser.userId,'')?></th>
					<th style="display:none;"><?=strUtil.doNull(rows[i].uctUser.userCname,'')?></th>
					<th style="display:none;"><?=strUtil.doNull(rows[i].uctUser.userLevel,'')?></th>
					<th style="display:none;"><?=strUtil.doNull(rows[i].uctUser.orgId,'')?></th>
					<td><?=(pageObj.currentPage-1)*pageObj.rows+(i+1)?></td>
					<!-- temp="dataList_template_content" start -->
					<td style='display:none;'><input type="hidden" name="input_primaryKey" obj-name="uctUser" primary="userId" value="<?=strUtil.doNull(rows[i].uctUser.userId,'')?>"/></td>
					<td><?=strUtil.doNull(rows[i].uctUser.userCname,'')?></td>
					<td><?=dictListMap['channelLevel'][strUtil.doNull(rows[i].uctUser.userLevel,'')]?></td>
					<td><?=strUtil.doNull(rows[i].uctUser.userEname,'')?></td>
					<td><?=strUtil.doNull(rows[i].uctUser.frontSysName,'')?></td>
					<%--			<td ><?if(!strUtil.isNull(rows[i].uctUser.usbKey)){?><?=rows[i].uctUser.usbKey?>%<?}else{?><span>&nbsp;</span><?}?></td>--%>
					<%--				<td><?=dictListMap['userStatus'][strUtil.doNull(rows[i].uctUser.userStatus,'')]?></td>--%>
					<%--				<td><?=getFormatDateByLong(rows[i].uctUser.createTime,'yyyy-MM-dd hh:mm:ss')?></td>--%>
					<td>
						<a href="javascript:;" title="pages/indexPage/indexPage?qdsid=<?=rows[i].uctUser.userId?>" onclick="copyUrl(this,'<?=rows[i].uctUser.userId?>','<?=rows[i].uctUser.userCname?>')">复制链接</a>
						&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="downloadQrcode('<?=rows[i].uctUser.userId?>','<?=rows[i].uctUser.userCname?>')">下载小程序码</a>
					</td>
					<!-- temp="dataList_template_content" end -->
					<td>
						<button type="button" class="btn btn-success btn-xs" onclick="toLoad(this,'view')"><i class="fa fa-search-plus"></i> 查看</button>  
						<button type="button" class="btn btn-warning btn-xs" onclick="toLoad(this,'edit');"><i class="fa fa-edit"></i> 修改</button>  
						<button type="button" class="btn btn-info btn-xs" onclick="toLoad(this,'edit_pass');"><i class="fa fa-edit"></i> 修改密码</button>  
						<button type="button" class="btn btn-danger btn-xs" onclick="toBeMember('<?=rows[i].uctUser.userId?>');"><i class="fa fa-trash-o"></i> 取消渠道商</button>  
						<?if(loginUserType=='manager'){?>
						<button type="button" class="btn btn-danger btn-xs" onclick="toDele('<?=rows[i].uctUser.userId?>');"><i class="fa fa-trash-o"></i> 删除</button>
						<?}?>
					</td>
				</tr>
				<?}?>
			</script>
			<script type="text/template" id="proList-template">
				<? for ( var i = 0; i < rows.length; i++) {?>
				<div class="panel panel-info">
					<div class="panel-heading"><?=rows[i].text?></div>
					<div class="panel-body">
						<? for ( var j = 0; j < rows[i].proList.length; j++) {?>
						<div class="col-lg-3 box-body">
							<div class="box box-solid text-left box-default boxsdes" id="pro_check_boxsdes_<?=rows[i].proList[j].ssInsurPro.infoId?>">
								<input type="hidden"  name="ssOrgProRelation.userId" value="<?=selectUserId?>" disabled="disabled" />
								<input type="hidden"  name="ssOrgProRelation.userOwner" value="<?=selectUserCname?>" disabled="disabled"/>
								<input type="checkbox" onclick="checkProed(this,'<?=rows[i].proList[j].ssInsurPro.infoId?>')" name="ssOrgProRelation.proId" value="<?=rows[i].proList[j].ssInsurPro.infoId?>"
									   class="set_pro_css_<?=rows[i].proList[j].ssInsurPro.infoId?>">&nbsp;
								<?=rows[i].proList[j].ssInsurPro.agentRiskCname?>
								<div class="yjbl hidden">
									<?var fatherBkgeRatio=-1; if(rows[i].proList[j].ssOrgProRelation){ fatherBkgeRatio=rows[i].proList[j].ssOrgProRelation.bkgeRatio}?>
									分佣比例:<input  type="text" disabled="disabled" size="12" father-bkgeratio=<?=fatherBkgeRatio?> onblur="checkIsNumber(this)" name="ssOrgProRelation.bkgeRatio" placeholder="推广费比例" value="0" id="input_bkgeRatio_<?=rows[i].proList[j].ssInsurPro.infoId?>"/>%
								</div>
							</div>
						</div>
						<?}?>
					</div>
				</div>
				<?}?>
				<?if(rows.length==0){?>
				<div class="text-danger">当前渠道商的上级渠道商还未配置产品！</div>
				<?}?>
			</script>

			<!-- Part 三、 以下是js模块区域 -->
			<script>
				var clickMenu = "channel-org";
				var myPage,dataListId,searchFormId;
				myPage = 10;//定义列表数据
				dataListId = "dataList";//显示列表数据div的id
				searchFormId = "searchForm";//搜索表单Id
				var userLevel = strUtil.doNull('${loginUser.user.userLevel}',1),userId='${loginUser.userId}',userCname='${loginUser.userCname}',login_usbKey=strUtil.doNull('${loginUser.user.usbKey}','50'),login_userType='${loginUser.userType}';
				var selected_userId='',selected_userCname='',selected_userLevel='',selected_fatherUserId='';
				/**
				 * 初始化数据字典，id传入#id 返回值Map用法：dictListMap["userType"][rows[i].userType]
				 */
				var dictListMap = DictUtil.initDictAndDymic();

				$(function () {
					//1、加载分页列表数据
					getTableData();

					//2、控制是否启用token
					//setToken();

				});

				$(function () {
					//设置数据行选中效果
					$('#'+dataListId+' tbody').on('click','tr', function (e) {
						if ( $(this).hasClass('selected') ) {
						}
						else {
							$('tr.selected').removeClass('selected');
							$(this).addClass('selected');
						}
						selected_userId = $('tr.selected th').eq(0).html();
						selected_userCname=$('tr.selected th').eq(1).html();
						selected_userLevel=$('tr.selected th').eq(2).html();
						selected_fatherUserId=$('tr.selected th').eq(3).html();
					} );
				});
				//注入日历框样式
				var dateObject = $('.datepicker').datepicker( {
					language : 'zh-CN',
					//inline: true,
					todayBtn : "linked",
					format : "yyyy-mm-dd",
					autoclose: true
				}).on('hide',function(e) {
					//bootstrap datepicker与bootstrapValidator同时使用时选择日期后无法正常触发校验的解决方法
					//当日期选择框关闭时，执行刷新校验。
					var fieldName = $(this).attr("name");//获取当前元素name
					var formId = $(this).parents("form").eq(0).attr("id");//获取当前元素所在父层级中的就近的formId
					$("#"+formId).data('bootstrapValidator').updateStatus(fieldName,'NOT_VALIDATED',null).validateField(fieldName);
				});

				//给模态窗口内form表单内的所有支持必填项的元素注入校验
				$(".modal").on('shown.bs.modal', function () {
					$(this).find("form").each(function(){
						var formId = $(this).attr("id");
						if(!strUtil.isNull(formId)){
							formId="#"+formId;
							setValidate(formId);//定义add表单验证属性
							mytools.cleanValidate(formId);//清空上次校验规则提示
						}
					});
				});

				//打开添加modal
				function toAdd(type){
					mytools.cleanData(".addFormBody");//清空表单元素上次填写的内容；
					$(".datepicker").val("");
					var span_add_title = '';
					var nowLevel = 1,fatherId=0,fatherCname = '无';
					if(type=='0'){
						$('.father_channel_id').val(0);
					}else{
						nowLevel = userLevel*1+1;
						fatherId = userId;
						fatherCname = userCname;
					}
					var levelText = dictListMap['channelLevel'][nowLevel];
					if(strUtil.isNull(levelText)){
						layer.alert("未配置"+nowLevel+"级渠道商级别数据字典，请先联系管理员！");
						return;
					}
					$("#addForm1").find("input[name='uctUser.orgId']").val(fatherId);
					$("#addForm1").find("input[name='uctUser.orgEname']").val(fatherCname);
					$("#addForm1").find("input[name='uctUser.userLevel']").val(nowLevel);
					var tipsText ='增加'+levelText;
					tipsText+='，其上级渠道商是:'+fatherCname;
					$("#span_add_title").text(tipsText);
					$("#my_modal_add").modal("show");
				}
				//设置产品
				function toSetPro() {
					if(strUtil.isNull(selected_userId)){
						layer.alert("请先选中一条数据！");
						return;
					}
					console.log('selected_userId',selected_userId);
					var index_load = layer.load(1, {shade: false});
					var paramLoadData = {};
					var dataListId = "proList";
					paramLoadData['formName']='searchForm';
					paramLoadData['pageName']='ss-insur-pro';
					if(selected_userLevel!='1'){
						paramLoadData['pageName']='ss-org-pro-relation-search2';
						paramLoadData['ssOrgProRelation.w_userId']=selected_fatherUserId;
					}
					$("#span_set_pro_title").text(selected_userCname);
					$("#setproForm1").find("input[name='ssOrgProRelation.w_userId']").val(selected_userId);
					$.ajax({
						type:'get',url:common_list_url,data:paramLoadData,dataType:'json',
						success: function(myData){
							if("T"==myData.flag){
								console.log('prolist',myData);
								var cateMap={},cateRows=new Array();
								for(var i=0;i<myData.rows.length;i++){
									var proType=myData.rows[i].ssInsurPro.proType;
									if(!cateMap[proType]){
										cateMap[proType] = {proList:[]};
									}
									cateMap[proType].proList.push(myData.rows[i]);
								}
								var proCategoryMap=dictListMap['proCategory'];
								for(var key in cateMap){
									cateRows.push({text:proCategoryMap[key],proList:cateMap[key].proList});
								}
								// console.log('cateMap',cateMap);
								var myDataNew={};
								myDataNew.selectUserId=selected_userId;
								myDataNew.selectUserCname=selected_userCname;
								myDataNew.rows=cateRows;
								console.log('myDataNew',myDataNew);
								var data = baidu.template(dataListId+"-template",eval(myDataNew));
								$("#"+dataListId+"-body").html(data);
								//选中历史选择项
								$.getJSON(common_list_url,{'pageName':'ss-org-pro-relation','formName':'searchForm','ssOrgProRelation.w_userId':selected_userId}, function(myData2){
									console.log('prolistuser',myData2);
									layer.close(index_load);
									if(myData2.flag=='T'&&myData2.total>0){
										for(var j=0;j<myData2.rows.length;j++){
											var my_proId = myData2.rows[j].ssOrgProRelation.proId;
											var my_bkgeRatio = myData2.rows[j].ssOrgProRelation.bkgeRatio;
											var obxs = $("#pro_check_boxsdes_"+my_proId);
											obxs.find("input[type='checkbox']").prop("checked",true);
											obxs.find(".yjbl").removeClass("hidden");
											obxs.find("input[type='hidden']").attr("disabled",false)
											obxs.find(".yjbl").find("input").attr("disabled",false);
											obxs.find("input[name='ssOrgProRelation.bkgeRatio']").val(my_bkgeRatio);
										}
									}
								});
								$("#my_modal_set_pro").modal("show");
							}
						}
					});
				}


				function toSelectChanel() {
					if(strUtil.isNull(selected_userId)){
						layer.alert("请先选中一条数据！");
						return;
					}
					mytools.cleanData("#updataChannelForm1");//清空表单元素上次填写的内容；
					$(".span_updata_channel_title").text(selected_userCname);
					$("#span_in_channel_level_text").text(dictListMap['channelLevel'][selected_userLevel]);
					$("#editForm1_channel_orgUser").empty();//清空select内option元素内容；
					$("#editForm1_channel_orgUser").prepend("<option value=''>--请选择--</option>");//添加第一个option值
					$("#updataChannelForm1").find("input[name='uctUser.w_orgId']").val(selected_userId);
					$.getJSON(common_list_url,
							{'pageName':'user-list','formName':'searchForm-new','uctUser.w_userType':"broker","uctUser.w_sysName":"ssb","uctUser.w_userLevel":selected_userLevel,"result_column":"uctUser.userId,uctUser.userCname"},
							function(myData){
								if(myData.flag=='T'&&myData.total>0){
									for(var j=0;j<myData.rows.length;j++){
										var my_userId = myData.rows[j].uctUser.userId;
										var my_userCname = myData.rows[j].uctUser.userCname;
										if(my_userId!=selected_userId){
											$("#editForm1_channel_orgUser").append("<option value='"+my_userId+"'>"+my_userCname+"</option>");
										}
									}
								}
							});
					$("#my_modal_updata_channel").modal("show");
				}
				function copyUrl(obj,channelId,channelName) {
					var textContent = $(obj).attr("title");
					$('#copy_textarea').val(textContent).show();
					var copy_textareaObj=document.getElementById("copy_textarea");
					copy_textareaObj.select(); // 选择对象
					document.execCommand('copy', false, null);
					$('#copy_textarea').hide();
					layer.msg("复制链接成功！");
				}
				function downloadQrcode(channelId,channelName) {
					var index_load = layer.load(1, {shade: false});
					var paramData = {};
					paramData["channelId"]=channelId;
					paramData["channelName"]=channelName;
					$.ajax({
						type:"get",
						url:ctx+"/api/wechatXcxQrcode",
						data: paramData,dataType:"json",
						success: function(myData){
							layer.close(index_load);
							console.log('wechatXcxQrcode.res',myData);
							var result = myData.flag;
							if(result=="T"){
								var url = myData.downloadPath;
								var fileName=myData.fileName;
								var conHtmls = "<div class='col-lg-12 text-center'><img class='img-responsive' style='width:300px;height:265px' src='"+url+"'/>";
								conHtmls+="<a class='btn btn-warning' href='${ctx}/api/download?fileName="+fileName+"'>图片下载</a>";
								conHtmls+="</div>";
								layer.open({
									type: 1,
									closeBtn: 1, //关闭按钮是否显示 1显示0不显示
									title: "["+channelName+"]小程序分项二维码预览", //页面标题
									shadeClose: false, //点击遮罩区域是否关闭页面
									shade: 0.8,  //遮罩透明度
									area: ['310px', '350px'],  //弹出层页面比例
									content:conHtmls
								});
							}else{
								layer.alert(myData.msg);
							}
						}
					});
				}

				function checkProed(obj,proId) {
					var isChecked = $(obj).is(":checked");
					var obxs = $("#pro_check_boxsdes_"+proId);
					if(isChecked){
						obxs.find("input[type='hidden']").attr("disabled",false);
						obxs.find(".yjbl").removeClass("hidden");
						obxs.find(".yjbl").find("input").attr("disabled",false);
					}else{
						obxs.find("input[type='hidden']").attr("disabled",true);
						obxs.find(".yjbl").addClass("hidden");
						obxs.find(".yjbl").find("input").attr("disabled",true);
					}
				}
				function checkIsNumber(obj) {
					var objVal = $(obj).val();
					var fatherBkgeratio = $(obj).attr("father-bkgeratio");

					if(!strUtil.isNull(objVal)){
						var objId = $(obj).attr("id");
						if(isNaN(objVal)){
							layer.tips('只能输入数字！', '#'+objId, {tips: 3});
							$(obj).val("0");
							return;
						}
						if(fatherBkgeratio*1>-1 && objVal*1>fatherBkgeratio*1){
							layer.tips('不能大于父级分佣比例'+fatherBkgeratio+'%！', '#'+objId, {tips: 3});
							$(obj).val("0");
							return;
						}
					}
				}
				//数据toLoad读取（查看、编辑）数据
				function toLoad(obj,type){
					if("view"==type){
						$("#my_modal_view").modal("show");
					}else if("edit"==type){
						mytools.cleanData(".editFormBody");//清空表单元素上次填写的内容；
						$("#my_modal_edit").modal("show");
					}else if("edit_pass"==type){
						mytools.cleanData(".editpassFormBody");
						$("#my_modal_edit_pass").modal("show");
					}
					// else if('set_pro'==type){
					//     mytools.cleanData(".setproFormBody");
					//     $("#my_modal_set_pro").modal("show");
					// }
					var paramLoadData = {};
					var inputPrimaryObj = $(obj).parent().parent().find("input[name='input_primaryKey']");
					paramLoadData["pageName"]=$("#searchForm").find("input[name='pageName']").val();
					paramLoadData["formName"]=$("#searchForm").find("input[name='formName']").val();
					if(inputPrimaryObj.length>0){
						for(var k=0;k<inputPrimaryObj.length;k++){
							var pkobj=$(inputPrimaryObj[k]);
							paramLoadData[pkobj.attr("obj-name")+".w_"+pkobj.attr("primary")]=pkobj.val();
						}
						$.get(common_info_url, paramLoadData,function(myData){
							console.log(myData);
							//反显加载数据
							if(myData){
								for(var objNameKey in myData){
									FormUtil.loadView(objNameKey, myData[objNameKey],"#my_modal_"+type);
								}
							}
						},"json");
					}
				}

				//取消渠道商，先判断该渠道商下是否有下级
				function toBeMember(userId){
					var index_submit = layer.confirm("您确定要取消该渠道商资格吗？", {btn: ["Yes","No"],closeBtn: 0,offset: "220px"}
							, function(){
								layer.close(index_submit);
								var paramData = {};
								paramData["pageName"]="uct-user-search-for-org";
								paramData["formName"]="searchForm";
								paramData["uctUser.w_orgId"]=userId;
								$.ajax({
									type:"get",
									url:common_list_url,
									data: paramData,dataType:"json",
									success: function(myData){
										console.log('myData.res',myData);
										if(myData.flag=='T'&&myData.total>0){
											layer.alert("当前渠道商有下级渠道商或者会员，请先平移渠道商后再操作！");
											return;
										}else{
											var paramData1 = {};
											paramData1["pageName"]="uct-user-edit";
											paramData1["formName"]="editForm";
											paramData1["uctUser.w_userId"]=userId;
											paramData1["uctUser.userLevel"]="0";
											paramData1["uctUser.userType"]="member";
											$.ajax({
												type:"post",
												url:common_submit_url,
												data: paramData1,dataType:"json",
												success: function(myData){
													console.log(myData);
													if(myData.flag=="T"){
														result = myData;
														layer.alert(myData.msg);
													}else{
														setToken();
														layer.alert(myData.msg);
													}
													layer.close(index_submit);
													refresh()
												}
											});
										}
									}
								});
							});
				}

				//删除调用
				function toDele(userId){
					var index_submit = layer.confirm("您确定要删除信息吗？", {btn: ["Yes","No"],closeBtn: 0,offset: "220px"}
							, function(){
								layer.close(index_submit);
								var paramData = {};
								paramData["pageName"]="ss-channel-del";
								paramData["formName"]="delForm";
								paramData["userId"]=userId;
								$.ajax({
									type:"post",
									url:common_submit_url,
									data: paramData,dataType:"json",
									success: function(myData){
										console.log('del.res',myData);
										var result = myData.flag;
										if(result=="T" && myData.result=="T"){
											refresh();
										}else{
											layer.alert(myData.msg);
										}
									}
								});
							});
				}
				//加载列表数据
				function getTableData(){
					if(strUtil.isNull($("#"+searchFormId).find("input[name='pageName']").val())){return;}
					var index_load = layer.load(1, {shade: false});
					$.ajax({
						type:'get',
						url:common_list_url,
						data:$("#"+searchFormId).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchFormId).serialize(),myPage),
						dataType:'json',
						success: function(myData){
							console.log(myData);
							if("T"==myData.flag){
								myData.loginUserId=userId;
								myData.loginUserType=login_userType;
								var data = baidu.template(dataListId+"-template",eval(myData));
								$("#"+dataListId+"-body").html(data);
								var option= {
									ele:$("#"+dataListId+"-page")[0],
									total:myData.total,
									fn:getTableData,
									url:common_list_url+"?"+$("#"+searchFormId).serialize()
								}
								generatePages(option);

							}
							layer.close(index_load);
						}
					});
				}
				//给渠道商用户分配角色
				function giveRoleChannelByUserId(userId){
					var index_load = layer.msg('正在分配渠道商角色，请稍等！');
					$.ajax({type:'get',
						url:common_info_url,
						data:{'pageName':'uct-role-list','formName':'searchForm','uctRole.w_roleEname':'ssb_role_channel'},
						dataType:'json',
						success: function(myData){
							console.log("myRoleGiveData",myData);
							if(myData){
								var roleObj = myData.uctRole;
								var roleId = roleObj.roleId;
								var roleEname = roleObj.roleEname;
								$.ajax({type: "post",
									url: ctx+"/res/uct/admin/roleToUser?flag=add&roleEname="+roleEname+"&roleId="+roleId+"&userId="+userId,
									success: function(myData2){
										console.log('add role to user['+userId+']['+roleEname+']',myData2);
										index_load = layer.msg('渠道商角色分配完成！');
									}
								});
							}
						}
					});
				}
				//给渠道商-初始化资金余额对象
				function initUserBalance(userId){
					var index_load = layer.load(1, {shade: false});
					var paramData = {};
					paramData["pageName"]="ss-user-balance";
					paramData["formName"]="addForm";
					paramData["userId"]=userId;
					$.ajax({type: "post",
						url:common_submit_url,
						data:paramData,
						success: function(myData2){
							console.log('init balance to user['+userId+']',myData2);
							layer.close(index_load);
						}
					});
				}
				//切换渠道商级别控制其他元素
				// function changeChannelLevel(obj, id) {
				//     var selectedVal = $(obj).find("option:selected").val();
				// 	$("#addForm1").find("input[name='uctUser.orgEname']").val('');
				// 	$("#addForm1").find("input[name='uctUser.orgId']").val('');
				// 	$(id).val("");
				// 	if(selectedVal=='1'){
				// 		//一级无需选择上级渠道商
				// 		$(id).prop('disabled',true);
				// 		$("#addForm1").find("input[name='uctUser.orgId']").val('0');
				// 		$("#addForm1").find("input[name='uctUser.orgEname']").val('无');
				//         $(".tr_userLevel").find("input").prop('disabled',false);
				// 	}else{
				//         $(id).prop('disabled',false);
				//         $(".tr_userLevel").find("input").prop('disabled',true);
				//     }
				// }
				// function changeUserPass(obj) {
				// 	if($(obj).val()=='T'){
				// 		$("#tr_modify_pass").removeClass("hidden");
				// 	}else{
				// 		$("#tr_modify_pass").addClass("hidden");
				// 	}
				// }
				//提交tab1表单数据
				function submitForm1(formId,tabId){

					// return;
					//校验规则-表单提交时触发
					var validate = $('#'+formId).data('bootstrapValidator').validate();
					if(!validate.isValid()){ //如果校验不通过就返回
						return;
					}
					if("addForm1"==formId || "editpassForm1"==formId){
						var userPass1 = $('#'+formId).find("input[name='userPass1']").val();
						var userPass2 = $('#'+formId).find("input[name='userPass2']").val();
						if("editpassForm1"==formId){
							var user_old_pass =  $('#'+formId).find("input[name='user_old_pass']").val();
							if(user_old_pass==userPass1.md5()){
								layer.alert("新密码和原密码不能一样！", {closeBtn: 0 });
								return;
							}
						}
						if(userPass1!=userPass2){
							layer.alert("两次输入密码不一致！", {closeBtn: 0 });
							$('#'+formId).find("input[name='userPass2']").val("");
							return;
						}

						$('#'+formId).find("input[name='uctUser.userPass']").val(userPass1.md5());
					}
					if("updataChannelForm1"==formId){
						var options=$("#editForm1_channel_orgUser option:selected");
						$("#"+formId).find("input[name='uctUser.orgEname']").val(options.text());
					}
					if("setproForm1"==formId){
						var checkedTotal = $("#proList-body").find("input[type='checkbox']:checked").length;
						if(checkedTotal==0){
							$("#"+formId).find("input[name='pageName']").val("ss-org-pro-relation");
							$("#"+formId).find("input[name='formName']").val("delForm");
						}else{
							$("#"+formId).find("input[name='pageName']").val("ss-org-pro-relation-addbatch2");
							$("#"+formId).find("input[name='formName']").val("addFormBatch");
						}
					}
					console.log($("#"+formId).serialize());
					var index_submit = layer.confirm('您确定要保存信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
							, function(){
								layer.close(index_submit);
								var result = submitForm(formId,tabId);
								if(result){
									// layer.alert("提交成功！", {closeBtn: 0 });
									mytools.closeModal("my_modal_add");
									mytools.closeModal("my_modal_edit");
									mytools.closeModal("my_modal_edit_pass");
									mytools.closeModal("my_modal_set_pro");
									mytools.closeModal("my_modal_updata_channel");
									refresh();
									if("addForm1"==formId){
										var addUserId = result.ids.uctUser_userId;
										giveRoleChannelByUserId(addUserId);//同步授权
										// dictListMap = DictUtil.initDictAndDymic();
										initUserBalance(addUserId);
									}
									if("editForm1"==formId){
										var editUserId = $('#'+formId).find("input[name='uctUser.w_userId']").val();
										initUserBalance(editUserId);
									}
									setToken();
									if(!strUtil.isNull(tabId)){
										$('.nav-tabs a[href=\"#'+tabId+'\"]').tab('show'); // Select tab by name
									}
								}
							});

				}
				//提交表单数据
				function submitForm(formId,tabId){
					var result;
					var index_load = layer.load(1, {shade: false});
					$.ajax({
						type:'post',
						url:common_submit_url,
						data:$("#"+formId).serialize(),
						async:false,
						dataType:'json',
						success: function(myData){
							console.log(myData);
							if(myData.flag=="T"){
								result = myData;
							}else{
								setToken();
								layer.alert(myData.msg);
							}
							layer.close(index_load);
						},
						error: function (e) {
							layer.close(index_load);
						}
					});
					return result;
				}

				//刷新
				function refresh(){
					getTableData();
					selected_userId='';
					selected_userCname='';
					selected_userLevel='';
					selected_fatherUserId='';
				}
				//设置token
				function setToken(){
					$.ajax({
						type:'get',
						url:'${ctx}/sendPage/token?token=true',
						dataType:'text',
						success: function(myData){
							console.log(myData);
							$('.formToken').val(myData);
						}
					});
				}


				/**** Part 四、以下是自定义新增方法  ****/
//1.定义校验规则-定义
				function setValidate(id){
					$(id).each(function(){
						$(this).bootstrapValidator({
							feedbackIcons: {
								valid: 'glyphicon glyphicon-ok',
								invalid: 'glyphicon glyphicon-remove',
								validating: 'glyphicon glyphicon-refresh'
							},/** 以下需要结合实际业务清空补充个表单元素的验证规则 **/
							fields:{
								/**
								 "uctUser.usbKey":{
		    		 validators: {
						 // regexp: {regexp: /^\d+$|^\d*\.\d+$/, message: '只能输入数字'},
						 notEmpty: { message: '此项不能为空!' },
						 greaterThan: { inclusive:false,value: 0, message: '最小输入0' },
						 lessThan: { inclusive:false, value: login_usbKey, message: '最大输入'+login_usbKey },
						 numeric: { message: '只能输入数字' }
		              }
				}**/
							}
						});
					});
				}


			</script>
		</section>
		<!-- Main end -->
	</div>
	<!-- foot start -->
	<%@include file="/common/ssb/foot.jsp" %>
	<!-- foot start -->
</div>
<!-- /.content-wrapper -->
</body>
</html>






















